//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.navinfo.opentsp.platform.computing.serializer;

import com.google.common.base.Charsets;
import com.navinfo.opentsp.platform.computing.util.DateUtils;
import com.navinfo.opentsp.platform.location.protocol.common.LCTerminalStatisticData;
import org.apache.flume.Context;
import org.apache.flume.Event;
import org.apache.flume.serialization.EventSerializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.io.OutputStream;

/**
 * 0F38统计信息
 * HDFS_Sink的Statistic序列化器，拼接成字段间通过\001分割的字符串
 */
public class HDFSStatisticSerializer implements EventSerializer {
    private static final Logger logger = LoggerFactory.getLogger(HDFSStatisticSerializer.class);

    private final String APPEND_NEWLINE = "appendNewline";
    private final boolean appendNewline;
    private final String splitStr = "\001";
    private final OutputStream out;

    private HDFSStatisticSerializer(OutputStream out, Context ctx) {
        this.appendNewline = ctx.getBoolean(APPEND_NEWLINE, true);
        this.out = out;
    }
    @Override
    public boolean supportsReopen() {
        return false;
    }
    @Override
    public void afterCreate() {}
    @Override
    public void afterReopen() {}
    @Override
    public void beforeClose() {}
    @Override
    public void flush() throws IOException {}

    @Override
    public void write(Event event) throws IOException {
        try {
            //拼写落盘到HDFS的字符串。字段间分隔符是\001，null通过\N表示
            LCTerminalStatisticData.StatisticData statisticData = LCTerminalStatisticData.StatisticData.parseFrom(event.getBody());

            StringBuilder locationStr = new StringBuilder(5000);
            locationStr
                    .append(statisticData.getTime()).append(splitStr)
                    .append(statisticData.getLatitude()).append(splitStr)
                    .append(statisticData.getLongitude()).append(splitStr)
                    .append(statisticData.getHeight()).append(splitStr)
                    .append(statisticData.getDirection()).append(splitStr)
                    .append(statisticData.getSpeed()).append(splitStr)
                    .append(statisticData.getRouteStartTime()).append(splitStr)
                    .append(statisticData.getRouteEndTime()).append(splitStr)
                    .append(statisticData.getDriveCycleMileage()).append(splitStr)
                    .append(statisticData.getIdlingMileage()).append(splitStr)
                    .append(statisticData.getParingRangeMileage()).append(splitStr)
                    .append(statisticData.getParkingIdleTime()).append(splitStr)
                    .append(statisticData.getBrakeNumber()).append(splitStr)
                    .append(statisticData.getCumulativeMileage()).append(splitStr)
                    .append(statisticData.getBrakingTime()).append(splitStr)
                    .append(statisticData.getVehicleEstimatedLoad()).append(splitStr)
                    .append(statisticData.getInitialTotalFuelConsumption()).append(splitStr)
                    .append(statisticData.getTerminationTotalFuelConsumption()).append(splitStr)
                    .append(statisticData.getCruiseRange()).append(splitStr)
                    .append(statisticData.getAverageSpeedInterval()).append(splitStr)
                    .append(statisticData.getOverSpeedTimes()).append(splitStr)
                    .append(statisticData.getIdlingFuelConsumption()).append(splitStr)
                    .append(statisticData.getParkingIdleFuelConsumption()).append(splitStr)
                    .append(statisticData.getVersion()).append(splitStr)
                    .append(statisticData.getRetransmissionPackets()).append(splitStr)
                    .append(statisticData.getProtocolVersion()).append(splitStr)
                    .append(statisticData.getRouteStopFlag()).append(splitStr)
                    .append(statisticData.getTerminalId()).append(splitStr)
                    .append(statisticData.getRouteStartMileage()).append(splitStr)
                    .append(statisticData.getRouteStartFuelConsumption()).append(splitStr)
                    .append(statisticData.getRouteStartLatitude()).append(splitStr)
                    .append(statisticData.getRouteStartLongitude()).append(splitStr)
                    .append(statisticData.getRouteStartHeight()).append(splitStr)
                    .append(statisticData.getRouteStartDirection()).append(splitStr)
                    .append(statisticData.getRouteEndMileage()).append(splitStr)
                    .append(statisticData.getRouteEndFuelConsumption()).append(splitStr)
                    .append(statisticData.getRouteEndLatitude()).append(splitStr)
                    .append(statisticData.getRouteEndLongitude()).append(splitStr)
                    .append(statisticData.getRouteEndHeight()).append(splitStr)
                    .append(statisticData.getRouteEndDirection()).append(splitStr)
                    .append(statisticData.getRouteIntegralMileage()).append(splitStr)
                    .append(statisticData.getRouteGpsIntegralMileage()).append(splitStr)
                    .append(statisticData.getIntegralMileage()).append(splitStr)
                    .append(statisticData.getGpsIntegralMileage()).append(splitStr)
                    .append(statisticData.getVehicleTotalMileage()).append(splitStr)
                    .append(statisticData.getSharpCurveFrequency()).append(splitStr)
                    .append(statisticData.getSharpCurveMileage()).append(splitStr)
                    .append(statisticData.getRouteIntegralFuelConsumption()).append(splitStr)
                    .append(statisticData.getRouteTotalFuelConsumption()).append(splitStr)
                    .append(statisticData.getAverageFuelConsumption()).append(splitStr)
                    .append(statisticData.getOverSpeedDistance()).append(splitStr)
                    .append(statisticData.getOverSpeedFuelConsumption()).append(splitStr)
                    .append(statisticData.getAverageSpeedExcludeIdleTime()).append(splitStr)
                    .append(statisticData.getAverageSpeedIncludeIdleTime()).append(splitStr)
                    .append(statisticData.getMaxSpeed()).append(splitStr)
                    .append(statisticData.getParkingPowerOnTime()).append(splitStr)
                    .append(statisticData.getCityDrivingMileage()).append(splitStr)
                    .append(statisticData.getCityDrivingTime()).append(splitStr)
                    .append(statisticData.getCityDrivingFuelConsumption()).append(splitStr)
                    .append(statisticData.getRuralDrivingMileage()).append(splitStr)
                    .append(statisticData.getRuralDrivingTime()).append(splitStr)
                    .append(statisticData.getRuralDrivingFuelConsumption()).append(splitStr)
                    .append(statisticData.getEcoDrivingMileage()).append(splitStr)
                    .append(statisticData.getEcoDrivingTime()).append(splitStr)
                    .append(statisticData.getEcoDrivingFuelConsumption()).append(splitStr)
                    .append(statisticData.getUpSlopeDrivingMileage()).append(splitStr)
                    .append(statisticData.getUpSlopeDrivingTime()).append(splitStr)
                    .append(statisticData.getUpSlopeDrivingFuelConsumption()).append(splitStr)
                    .append(statisticData.getDownSlopeDrivingMileage()).append(splitStr)
                    .append(statisticData.getDownSlopeDrivingTime()).append(splitStr)
                    .append(statisticData.getDownSlopeDrivingFuelConsumption()).append(splitStr)
                    .append(statisticData.getLevelRoadDrivingMileage()).append(splitStr)
                    .append(statisticData.getLevelRoadDrivingTime()).append(splitStr)
                    .append(statisticData.getLevelRoadDrivingFuelConsumption()).append(splitStr)
                    .append(statisticData.getColdEngineSharpDrivingMileage()).append(splitStr)
                    .append(statisticData.getColdEngineSharpDrivingTime()).append(splitStr)
                    .append(statisticData.getColdEngineSharpDrivingFuelConsumption()).append(splitStr)
                    .append(statisticData.getCruiseControlDrivingTime()).append(splitStr)
                    .append(statisticData.getCruiseControlDrivingFuelConsumption()).append(splitStr)
                    .append(statisticData.getEngineOverSpeedDrivingMileage()).append(splitStr)
                    .append(statisticData.getEngineOverSpeedDrivingTime()).append(splitStr)
                    .append(statisticData.getEngineOverSpeedDrivingFuelConsumption()).append(splitStr)
                    .append(statisticData.getShiftGearsFrequency()).append(splitStr)
                    .append(statisticData.getSharpDownSpeedTime()).append(splitStr)
                    .append(statisticData.getSharpDownSpeedMileage()).append(splitStr)
                    .append(statisticData.getSharpDownSpeedFrequency()).append(splitStr)
                    .append(statisticData.getSharpUpSpeedTime()).append(splitStr)
                    .append(statisticData.getSharpUpSpeedMileage()).append(splitStr)
                    .append(statisticData.getSharpUpSpeedFrequency()).append(splitStr)
                    .append(statisticData.getSharpUpSpeedFuelConsumption()).append(splitStr)
                    .append(statisticData.getSharpStepOnAcceleratorMileage()).append(splitStr)
                    .append(statisticData.getSharpStepOnAcceleratorTime()).append(splitStr)
                    .append(statisticData.getSharpStepOnAcceleratorFuelConsumption()).append(splitStr)
                    .append(statisticData.getVehicleParkFrequency()).append(splitStr)
                    .append(statisticData.getVehicleStartFrequency()).append(splitStr)
                    .append(statisticData.getVehicleColdStartFrequency()).append(splitStr)
                    .append(statisticData.getFuelChargePercent()).append(splitStr)
                    .append(statisticData.getFuelChargeNumber()).append(splitStr)
                    .append(statisticData.getFuelLeakPercent()).append(splitStr)
                    .append(statisticData.getFuelLeakNumber()).append(splitStr)
                    .append(statisticData.getVehicleStartTime()).append(splitStr)
                    .append(statisticData.getVehicleStartFuelConsumption()).append(splitStr)
                    .append(statisticData.getAcceleratorStabilityFrequency()).append(splitStr)
                    .append(statisticData.getAcceleratorStabilityTime()).append(splitStr)
                    .append(statisticData.getInstrumentFuelConsumption()).append(splitStr)
                    .append(statisticData.getClutchSwitchTime()).append(splitStr)
                    .append(statisticData.getMaxEngineRotation()).append(splitStr)
                    .append(statisticData.getAverageEngineRotation()).append(splitStr)
                    .append(statisticData.getAverageAccelerator()).append(splitStr)
                    .append(statisticData.getSpeedRange01Mileage()).append(splitStr)
                    .append(statisticData.getSpeedRange01Time()).append(splitStr)
                    .append(statisticData.getSpeedRange01FuelConsumption()).append(splitStr)
                    .append(statisticData.getSpeedRange02Mileage()).append(splitStr)
                    .append(statisticData.getSpeedRange02Time()).append(splitStr)
                    .append(statisticData.getSpeedRange02FuelConsumption()).append(splitStr)
                    .append(statisticData.getSpeedRange03Mileage()).append(splitStr)
                    .append(statisticData.getSpeedRange03Time()).append(splitStr)
                    .append(statisticData.getSpeedRange03FuelConsumption()).append(splitStr)
                    .append(statisticData.getSpeedRange04Mileage()).append(splitStr)
                    .append(statisticData.getSpeedRange04Time()).append(splitStr)
                    .append(statisticData.getSpeedRange04FuelConsumption()).append(splitStr)
                    .append(statisticData.getSpeedRange05Mileage()).append(splitStr)
                    .append(statisticData.getSpeedRange05Time()).append(splitStr)
                    .append(statisticData.getSpeedRange05FuelConsumption()).append(splitStr)
                    .append(statisticData.getSpeedRange06Mileage()).append(splitStr)
                    .append(statisticData.getSpeedRange06Time()).append(splitStr)
                    .append(statisticData.getSpeedRange06FuelConsumption()).append(splitStr)
                    .append(statisticData.getSpeedRange07Mileage()).append(splitStr)
                    .append(statisticData.getSpeedRange07Time()).append(splitStr)
                    .append(statisticData.getSpeedRange07FuelConsumption()).append(splitStr)
                    .append(statisticData.getSpeedRange08Mileage()).append(splitStr)
                    .append(statisticData.getSpeedRange08Time()).append(splitStr)
                    .append(statisticData.getSpeedRange08FuelConsumption()).append(splitStr)
                    .append(statisticData.getSpeedRange09Mileage()).append(splitStr)
                    .append(statisticData.getSpeedRange09Time()).append(splitStr)
                    .append(statisticData.getSpeedRange09FuelConsumption()).append(splitStr)
                    .append(statisticData.getSpeedRange10Mileage()).append(splitStr)
                    .append(statisticData.getSpeedRange10Time()).append(splitStr)
                    .append(statisticData.getSpeedRange10FuelConsumption()).append(splitStr)
                    .append(statisticData.getSpeedRange11Mileage()).append(splitStr)
                    .append(statisticData.getSpeedRange11Time()).append(splitStr)
                    .append(statisticData.getSpeedRange11FuelConsumption()).append(splitStr)
                    .append(statisticData.getSpeedRange12Mileage()).append(splitStr)
                    .append(statisticData.getSpeedRange12Time()).append(splitStr)
                    .append(statisticData.getSpeedRange12FuelConsumption()).append(splitStr)
                    .append(statisticData.getExceedSpeedRangeMileage()).append(splitStr)
                    .append(statisticData.getExceedSpeedRangeTime()).append(splitStr)
                    .append(statisticData.getExceedSpeedRangeFuelConsumption()).append(splitStr)
                    .append(statisticData.getAssistBrakeMileage()).append(splitStr)
                    .append(statisticData.getAssistBrakeTime()).append(splitStr)
                    .append(statisticData.getFatigueDrivingFrequency()).append(splitStr)
                    .append(statisticData.getParkingStepOnAcceleratorTime()).append(splitStr)
                    .append(statisticData.getParkingStepOnAcceleratorFuelConsumption()).append(splitStr)
                    .append(statisticData.getEngineWorkTime()).append(splitStr)
                    .append(statisticData.getDrivingHandbrakeUseFrequency()).append(splitStr)
                    .append(statisticData.getDrivingHandbrakeUseTime()).append(splitStr)
                    .append(statisticData.getDrivingHandbrakeUseMileage()).append(splitStr)
                    .append(statisticData.getParkingIdleHandbrakeUseFrequency()).append(splitStr)
                    .append(statisticData.getParkingIdleHandbrakeUseTime()).append(splitStr)
                    .append(statisticData.getGear01UseRatio()).append(splitStr)
                    .append(statisticData.getGear01Mileage()).append(splitStr)
                    .append(statisticData.getGear01FuelConsumption()).append(splitStr)
                    .append(statisticData.getGear01Time()).append(splitStr)
                    .append(statisticData.getGear01Frequency()).append(splitStr)
                    .append(statisticData.getGear02UseRatio()).append(splitStr)
                    .append(statisticData.getGear02Mileage()).append(splitStr)
                    .append(statisticData.getGear02FuelConsumption()).append(splitStr)
                    .append(statisticData.getGear02Time()).append(splitStr)
                    .append(statisticData.getGear02Frequency()).append(splitStr)
                    .append(statisticData.getGear03UseRatio()).append(splitStr)
                    .append(statisticData.getGear03Mileage()).append(splitStr)
                    .append(statisticData.getGear03FuelConsumption()).append(splitStr)
                    .append(statisticData.getGear03Time()).append(splitStr)
                    .append(statisticData.getGear03Frequency()).append(splitStr)
                    .append(statisticData.getGear04UseRatio()).append(splitStr)
                    .append(statisticData.getGear04Mileage()).append(splitStr)
                    .append(statisticData.getGear04FuelConsumption()).append(splitStr)
                    .append(statisticData.getGear04Time()).append(splitStr)
                    .append(statisticData.getGear04Frequency()).append(splitStr)
                    .append(statisticData.getGear05UseRatio()).append(splitStr)
                    .append(statisticData.getGear05Mileage()).append(splitStr)
                    .append(statisticData.getGear05FuelConsumption()).append(splitStr)
                    .append(statisticData.getGear05Time()).append(splitStr)
                    .append(statisticData.getGear05Frequency()).append(splitStr)
                    .append(statisticData.getGear06UseRatio()).append(splitStr)
                    .append(statisticData.getGear06Mileage()).append(splitStr)
                    .append(statisticData.getGear06FuelConsumption()).append(splitStr)
                    .append(statisticData.getGear06Time()).append(splitStr)
                    .append(statisticData.getGear06Frequency()).append(splitStr)
                    .append(statisticData.getGear07UseRatio()).append(splitStr)
                    .append(statisticData.getGear07Mileage()).append(splitStr)
                    .append(statisticData.getGear07FuelConsumption()).append(splitStr)
                    .append(statisticData.getGear07Time()).append(splitStr)
                    .append(statisticData.getGear07Frequency()).append(splitStr)
                    .append(statisticData.getGear08UseRatio()).append(splitStr)
                    .append(statisticData.getGear08Mileage()).append(splitStr)
                    .append(statisticData.getGear08FuelConsumption()).append(splitStr)
                    .append(statisticData.getGear08Time()).append(splitStr)
                    .append(statisticData.getGear08Frequency()).append(splitStr)
                    .append(statisticData.getGear09UseRatio()).append(splitStr)
                    .append(statisticData.getGear09Mileage()).append(splitStr)
                    .append(statisticData.getGear09FuelConsumption()).append(splitStr)
                    .append(statisticData.getGear09Time()).append(splitStr)
                    .append(statisticData.getGear09Frequency()).append(splitStr)
                    .append(statisticData.getGear10UseRatio()).append(splitStr)
                    .append(statisticData.getGear10Mileage()).append(splitStr)
                    .append(statisticData.getGear10FuelConsumption()).append(splitStr)
                    .append(statisticData.getGear10Time()).append(splitStr)
                    .append(statisticData.getGear10Frequency()).append(splitStr)
                    .append(statisticData.getGear11UseRatio()).append(splitStr)
                    .append(statisticData.getGear11Mileage()).append(splitStr)
                    .append(statisticData.getGear11FuelConsumption()).append(splitStr)
                    .append(statisticData.getGear11Time()).append(splitStr)
                    .append(statisticData.getGear11Frequency()).append(splitStr)
                    .append(statisticData.getGear12UseRatio()).append(splitStr)
                    .append(statisticData.getGear12Mileage()).append(splitStr)
                    .append(statisticData.getGear12FuelConsumption()).append(splitStr)
                    .append(statisticData.getGear12Time()).append(splitStr)
                    .append(statisticData.getGear12Frequency()).append(splitStr)
                    .append(statisticData.getGear13UseRatio()).append(splitStr)
                    .append(statisticData.getGear13Mileage()).append(splitStr)
                    .append(statisticData.getGear13FuelConsumption()).append(splitStr)
                    .append(statisticData.getGear13Time()).append(splitStr)
                    .append(statisticData.getGear13Frequency()).append(splitStr)
                    .append(statisticData.getGear14UseRatio()).append(splitStr)
                    .append(statisticData.getGear14Mileage()).append(splitStr)
                    .append(statisticData.getGear14FuelConsumption()).append(splitStr)
                    .append(statisticData.getGear14Time()).append(splitStr)
                    .append(statisticData.getGear14Frequency()).append(splitStr)
                    .append(statisticData.getGear15UseRatio()).append(splitStr)
                    .append(statisticData.getGear15Mileage()).append(splitStr)
                    .append(statisticData.getGear15FuelConsumption()).append(splitStr)
                    .append(statisticData.getGear15Time()).append(splitStr)
                    .append(statisticData.getGear15Frequency()).append(splitStr)
                    .append(statisticData.getGear16UseRatio()).append(splitStr)
                    .append(statisticData.getGear16Mileage()).append(splitStr)
                    .append(statisticData.getGear16FuelConsumption()).append(splitStr)
                    .append(statisticData.getGear16Time()).append(splitStr)
                    .append(statisticData.getGear16Frequency()).append(splitStr)
                    .append(statisticData.getGearOtherUseRatio()).append(splitStr)
                    .append(statisticData.getGearOtherMileage()).append(splitStr)
                    .append(statisticData.getGearOtherFuelConsumption()).append(splitStr)
                    .append(statisticData.getGearOtherTime()).append(splitStr)
                    .append(statisticData.getGearOtherFrequency()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange01Mileage()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange01Time()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange01FuelConsumption()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange01UseRatio()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange01MileageRatio()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange01FuelConsumptionRatio()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange02Mileage()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange02Time()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange02FuelConsumption()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange02UseRatio()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange02MileageRatio()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange02FuelConsumptionRatio()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange03Mileage()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange03Time()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange03FuelConsumption()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange03UseRatio()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange03MileageRatio()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange03FuelConsumptionRatio()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange04Mileage()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange04Time()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange04FuelConsumption()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange04UseRatio()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange04MileageRatio()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange04FuelConsumptionRatio()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange05Mileage()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange05Time()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange05FuelConsumption()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange05UseRatio()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange05MileageRatio()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange05FuelConsumptionRatio()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange06Mileage()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange06Time()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange06FuelConsumption()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange06UseRatio()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange06MileageRatio()).append(splitStr)
                    .append(statisticData.getEngineSpeedRange06FuelConsumptionRatio()).append(splitStr)
                    .append(statisticData.getExceedEngineSpeedRangeMileage()).append(splitStr)
                    .append(statisticData.getExceedEngineSpeedRangeTime()).append(splitStr)
                    .append(statisticData.getExceedEngineSpeedRangeFuelConsumption()).append(splitStr)
                    .append(statisticData.getExceedEngineSpeedRangeUseRatio()).append(splitStr)
                    .append(statisticData.getExceedEngineSpeedRangeMileageRatio()).append(splitStr)
                    .append(statisticData.getExceedEngineSpeedRangeFuelConsumptionRatio()).append(splitStr)
                    .append(statisticData.getCarbonDioxideEmissions()).append(splitStr)
                    .append(statisticData.getRoutingCase()).append(splitStr)
                    .append(statisticData.getExtendField01()).append(splitStr)
                    .append(statisticData.getExtendField02()).append(splitStr)
                    .append(statisticData.getExtendField03()).append(splitStr)
                    .append(statisticData.getExtendField04()).append(splitStr)
                    .append(statisticData.getExtendField05()).append(splitStr)
                    .append(statisticData.getExtendField06()).append(splitStr)
                    .append(statisticData.getExtendField07()).append(splitStr)
                    .append(statisticData.getExtendField08()).append(splitStr)
                    .append(statisticData.getExtendField09()).append(splitStr)
                    .append(statisticData.getExtendField10()).append(splitStr)
                    .append(statisticData.getEcoDrivingTimeRatio()).append(splitStr)
                    .append(statisticData.getSharpStepOnAcceleratorFrequency()).append(splitStr)
                    .append(statisticData.getIdlingFrequency()).append(splitStr)
                    .append(statisticData.getParingRangeFrequency()).append(splitStr)
                    //添加字段只能在分割线之上添加
                    //------------------------------------------分割线----------------------------------------
                    .append(DateUtils.format(statisticData.getTime() * 1000, "yyyyMMdd")).append(splitStr)
                    .append(statisticData.getTerminalId()%32);


            //将0F38报文拼接后写入hdfs
            this.out.write(locationStr.toString().getBytes(Charsets.UTF_8));
            if (this.appendNewline) {
                this.out.write(10);
            }
        }catch (Exception e){
            logger.error("执行HDFS的Statistic拦截器失败：" + e.getMessage(), e);
        }
    }

    public static class Builder implements EventSerializer.Builder {
        public Builder() { }
        @Override
        public EventSerializer build(Context context, OutputStream out) {
            return  new HDFSStatisticSerializer(out, context);
        }
    }
}
